using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class InteractionTarget:MonoBehaviour {

	public static HashSet<InteractionTarget> instances = new HashSet<InteractionTarget>();
	[SerializeField] Material selectMaterial;
	Material originalMaterial;
	SpriteRenderer spriteRenderer;
	public int flag;
	private void Start() {
		instances.Add(this);
		spriteRenderer=GetComponent<SpriteRenderer>();
		originalMaterial=spriteRenderer.material;
	}
	private void OnDestroy() {
		instances.Remove(this);
	}

	private void Update() {
		spriteRenderer.material=PlayerController.instance.currentInteractionTarget==this ? selectMaterial : originalMaterial;
	}

	public void Interact() {
		BroadcastMessage("OnInteraction");
	}

}
